/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package BeanRequest;

import Dao.DaoLogin;
import Pohos.Login;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author Duvan11
 */
// jsf managed bean
@ManagedBean
@RequestScoped
public class MBRLogin {

    private Login login;
    public MBRLogin() {
        this.login = new Login();
    }
    
    public String register()throws Exception
    {        
        DaoLogin daologin = new DaoLogin();
        daologin.register(this.login);
        return "index";
    }
    
    public void error(){
      FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error!", "Contact admin."));
    }
    
    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }
    
}
